#!/usr/bin/python

import re
import sqlite3

if __name__ == "__main__":
	lines = open("cites.txt").readlines()
	con = sqlite3.connect('cites.db')
	cur = con.cursor()
	for l in lines:
		mr = re.search("^([0-9]*) (.*)",l)
		if mr != None:			
			g = mr.groups()
			cur.execute("insert into cites_cite(cite,oid,rate) values('%s',%s, 0);" % (g[1].replace("'",r'"'),g[0]))
		else:
			print "error => %s" % l
	con.commit()
	cur.close()
		
